import Vue from "vue"
import VueRouter from 'vue-router'

Vue.use(VueRouter);

import Mobile from '@/view/Mobile.vue'
import MobileHome from '@/view/mobile/MobileHome.vue'
import MobileFooter from '@/components/mobile/default/MobileFooter.vue'
import MobileHeader from '@/components/mobile/default/MobileHeader.vue'
import MobileBooksList from '@/view/mobile/MobileBooksList.vue'
import MobileMine from '@/view/mobile/MobileMine.vue'
import MobileDetail from '@/view/mobile/MobileDetail.vue'
import MobileSearch from '@/view/mobile/MobileSearch.vue'
import MobileCart from '@/components/mobile/cart/MobileCart.vue'
import Home from '@/view/Home.vue'
import MobileLogin from '@/view/mobile/MobileLogin.vue'
import Admin from '@/view/Admin.vue'
import AdminHome from '@/view/pc/AdminHome.vue'
import AdminLogin from '@/view/pc/AdminLogin.vue'
import Hotlist from '@/view/pc/Hotlist.vue'
import AdminType from '@/view/pc/AdminType.vue'
import UpdateList from '@/components/admin/hotlist/UpdateList.vue'
import AdminBookList from '@/view/pc/AdminBookList.vue'


const routes = [{
		path: '/',
		redirect: '/home'
	},
	{
		path: '/home',
		name: 'Home',
		component: Home
	},
	{
		path: '/mobilelogin',
		name: 'MobileLogin',
		component: MobileLogin
	},
	{
		path: '/adminLogin',
		name: 'AdminLogin',
		component: AdminLogin
	},
	{
		path: '/mobile',
		name: 'Mobile',
		component: Mobile,
		children: [{
				path: 'home',
				name: 'MobileHome',
				components: {
					default: MobileHome,
					header: MobileHeader,
					footer: MobileFooter
				}
			},

			{
				path: 'bookslist',
				name: 'MobileBooksList',
				components: {
					default: MobileBooksList,
					header: MobileHeader,
					footer: MobileFooter
				}
			},
			{
				path: 'mine',
				name: 'MobileMine',
				components: {
					default: MobileMine,
					header: MobileHeader,
					footer: MobileFooter
				},
			},
			{
				path: 'bookdetail/:bookid',
				name: 'MobileDetail',
				component: MobileDetail,
			},
			{
				path: 'search',
				name: 'MobileSearch',
				components: {
					header: MobileSearch,
					footer: MobileFooter
				}
			},
			{
				path: 'cart',
				name: 'MobileCart',
				components: {
					header: MobileCart,
					footer: MobileFooter
				}
			},
		]
	},
	{
		path: '/admin',
		name: 'Admin',
		component: Admin,
		children: [
			{
			path: 'home',
			name: 'AdminHome',
			component: AdminHome,
		},
		{
			path: 'hotpic',
			name: 'Hotlist',
			component: Hotlist,
		},
		{
			path: 'update/:bookid',
			name: 'UpdateList',
			component: UpdateList,
		},
		{
			path: 'update',
			name: 'UpdateList',
			component: UpdateList,
		},
		// {
		// 	path: 'mine',
		// 	name: 'Updatepwd',
		// 	component: UpdateList,
		// },
		{
			path: 'type',
			name: 'AdminType',
			component: AdminType,
		},
		{
			path: 'booklist',
			name: 'AdminBookList',
			component: AdminBookList,
		},
		]
	}
];

const router = new VueRouter({
	routes
})

export default router;
